package com.nbsaas.boot.data.data.entity;

import com.nbsaas.boot.code.annotation.FormAnnotation;
import com.nbsaas.boot.code.annotation.FormField;
import com.nbsaas.boot.code.annotation.InputType;
import com.nbsaas.boot.code.annotation.SearchItem;
import com.nbsaas.boot.code.annotation.data.Dict;
import com.nbsaas.boot.code.annotation.data.DictItem;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import com.nbsaas.boot.rest.filter.Operator;
import lombok.Data;
import org.hibernate.annotations.Comment;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;

@org.hibernate.annotations.Table(appliesTo = "sys_common_query_macro", comment = "公共宏")
@Data
@FormAnnotation(title = "公共宏")
@Entity
@Table(name = "sys_common_query_macro")
public class QueryMacro extends AbstractEntity {

    @Column(length = 200)
    @SearchItem(label = "名称", name = "name")
    @FormField(title = "名称", grid = true, width = "300", col = 22, required = true)
    @Comment("名称")
    private String name;


    @Lob
    @FormField(title = "宏内容", width = "400", col = 22,type = InputType.textarea)
    @Comment("具体代码")
    private String content;


    @SearchItem(label = "宏类型", name = "macroType", operator = Operator.eq,classType = Integer.class)
    @FormField(title = "宏分类", col = 22)
    @Dict(
            items = {
                    @DictItem(label = "公共宏", value = 1)
            }
    )
    private Integer macroType;

    @Column(length = 500)
    @FormField(title = "备注", width = "400", col = 22,type = InputType.textarea)
    @Comment("备注")
    private String remark;



}
